﻿using Model;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
   public class MyContent_DAL
    {
        public List<MyContent_Model> Order()
        {
            string sql = "select * from Users,UsersOrder where Users.UsersID=UsersOrder.UsersID";
            List<MyContent_Model> Order = new List<MyContent_Model>();
            SqlDataReader sdr = DBHelper.ExecuteReader(sql);
            if (sdr.HasRows)
            {
                while (sdr.Read())
                {
                    MyContent_Model model = new MyContent_Model();
                    model.UsersID = Convert.ToInt32(sdr["UsersID"]);
                    model.UserName = sdr["UserName"].ToString();
                    model.UserEmail = sdr["UserEmail"].ToString();
                    model.UserPwd = sdr["UserPwd"].ToString();
                    model.UserBirthday = sdr["UserBirthday"].ToString();
                    model.UserAddress = sdr["UserAddress"].ToString();
                    model.UserNationality = sdr["UserNationality"].ToString();
                    model.Orderid = Convert.ToInt32(sdr["Orderid"]);
                    model.Orderdate = sdr["Orderdate"].ToString();
                    model.Orderstatus = Convert.ToInt32(sdr["Orderstatus"]);
                    model.Orderprice = Convert.ToInt32(sdr["Orderprice"]);
                    Order.Add(model);
                }

            }
            return Order;


        }
    }
}
